<template>
  <el-dialog
    title="流程图"
    :visible.sync="dialogVisible"
    width="60%"
    :before-close="handleClose">
    <img style="width: 100%;" :src="imgUrl" alt="流程图">
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="handleClose">关 闭</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { picture } from '@/api/designingScheme'

export default {
  name: 'FlowPicture',
  data () {
    return {
      dialogVisible: false,
      imgUrl: ''
    }
  },
  methods: {
    init (processId) {
      picture({ processId: processId }).then(res => {
        const blob = new Blob([res.res])
        this.imgUrl = (window.URL || window.webkitURL).createObjectURL(blob)
        this.dialogVisible = true
      })
    },
    handleClose () {
      this.imgUrl = ''
      this.dialogVisible = false
    }
  }
}
</script>
<style scoped lang='scss'>

</style>
